<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用按钮给表格填数据</title>
	</head>
	<body>
		<div>
			<table border="1">
				<tr>
					<td>照片：</td>
					<td><img :src="person.url" width="100" alt=""></td>
				</tr>
				<tr><td>姓名：</td><td>{{person.name}}</td></tr>
				<tr><td>年龄：</td><td>{{person.age}}</td></tr>
				<tr><td>好友：</td>
				    <td>
						<ul>
							<li v-for="name in person.friends">{{name}}</li>
						</ul>
					</td>
				</tr>
			</table>
			<input type="button"  value="请求数据" @click="f()"/>
		</div>
	</body>
	<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
	<script>
		let v=new Vue({
			el:"body>div",
			data:{
				person:{}
			},
			methods:{
				f(){
					v.person={name:"张三", age:18, url:"imgs/7.png", friends:["刘备","关羽"]}
				}
			}
		});
	</script>
</html>
